<?php


namespace App\Http\Controllers\cms;


use App\Engine\BaseController;
use App\Models\Project as ProjectModel;
use function app\Utils\go;

class Project extends BaseController
{
    /**
     * 获取楼栋
     */
    public function get()
    {
        $res=ProjectModel::with('imgs')->get();
        return go($res);
    }

    /**
     * 插入楼栋
     */
    public function insert()
    {
        $res=ProjectModel::create($this->post);
        return go($res);
    }


    public function update()
    {
        $res=ProjectModel::find($this->post['id'])->update($this->post);
        return go($res);
    }

    public function del()
    {
        $res=ProjectModel::find($this->get['id'])->delete();
        return go($res);
    }
}
